﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using Common.Model;
using Common.Error;
using OpenAPI.Model.OAuth;

namespace OpenAPI.IDAL.OAuth
{
    public interface IConsumer
    {
        bool ConsumerRegister(ConsumerInfo info, out ErrorType error);
        ConsumerInfo GetConsumer(string oauth_consumer_key, string oauth_consumer_secret);
        IList<ConsumerInfo> GetConsumers();
        bool ConsumerModify(ConsumerInfo info, out ErrorType error);
        bool DeleteConsumer(string oauth_consumer_key, string oauth_consumer_secret, out ErrorType error);

        string GetOAuthConsumerSecret(string oauth_consumer_key, out ErrorType error);
        string GetOAuthTokenSecret(string oauth_consumer_key, string oauth_token, out ErrorType error);
        bool ChkOAuthToken(string oauth_consumer_key, string oauth_token);

        AuthorizeTokenInfo RequestToken(string oauth_consumer_key, AuthorizeTokenInfo newToken, out ErrorType error);
        AuthorizeTokenInfo AuthorizeToken(AuthorizeTokenInfo authToken, out ErrorType error);
        AuthorizeTokenInfo ExchangeAccessToken(string oauth_token, string oauth_token_secret);


        #region 消费方等级/方法

        bool InsertConsumerLevel(ConsumerLevelInfo level, out ErrorType error);
        bool UpdateConsumerLevel(ConsumerLevelInfo level, out ErrorType error);
        bool DeleteConsumerLevel(string consumer_level, out ErrorType error);
        IList<ConsumerLevelInfo> GetConsumerLevels();
        ConsumerLevelInfo GetConsumerLevel(string consumer_level);
        bool ContainsMethodInConsumerLevel(string oauth_consumer_key, string method_name);

        IList<MethodInConsumerLevelInfo> GetMethodsInConsumerLevel(string consumer_level);
        bool SaveMethodsToConsumerLevel(string consumer_level, string[] arr_method, out ErrorType error);

        #endregion

    }//
}
